// Hps.TestClient.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <Poco/Net/Socket.h>
#include <Poco/Net/StreamSocket.h>

using namespace Poco;
using namespace Poco::Net;

int _tmain(int argc, _TCHAR* argv[])
{
	char buffer[4096];

	srand(GetTickCount());

	for (int i = 0; i < sizeof(buffer); i++) 
	{
		buffer[i] = (char) rand();
	}

	while (true)
	{
		StreamSocket socket;
		socket.connect(SocketAddress("127.0.0.1:5000"), Timespan(5));

		while (true)
		{
			try
			{
				socket.sendBytes(buffer, sizeof(buffer));
				socket.receiveBytes(buffer, sizeof(buffer));
			}
			catch (...)
			{
				break;
			}
		}
	}
	return 0;
}

